package oop2;

/**
 * Created with IntelliJ IDEA.
 * ClassName: PersonTest
 * Package: oop2
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-21
 * Time: 14:22
 */

public class PersonTest {
    public static void main(String[] args) {
        Person p1 = new Person();
        p1.setAge(10);
        System.out.println(p1.age);
    }
}

class Person{
    String name;
    int age;

    String email;

    public void setAge(int age) {
        //如果这样赋值 那么就是就近原则  age就都是这个形参了
        this.age = age;
        //this 动态的表示 当前对象 谁调用 谁就是this
    }

    public Person(){}

    public Person(String name,String email){
        this.name = name;
        this.email = email;
    }
}
